home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / sys / amiga / programmer / 2994 < prev    next >
Encoding:
Text File  |  1996-08-05  |  1.8 KB  |  48 lines

  1. Newsgroups: comp.sys.amiga.programmer
  2. Path: nntp.coast.net!torn!utnut!utgpu!normb
  3. From: normb@gpu.utcc.utoronto.ca (Norman Baccari)
  4. Subject: Problems With LoadSeg()
  5. Message-ID: <DMF0vK.LI0@gpu.utcc.utoronto.ca>
  6. Organization: UTCC Public Access
  7. Distribution: Earth
  8. Date: Wed, 7 Feb 1996 17:06:56 GMT
  9.  
  10.  
  11. Im  trying  to  find  the  best  way  to read in a libraries
  12. IdString.   I've  tried  OpenLibrary()  but  this  has  some
  13. undesireable  side  effects.  Im now trying to use LoadSeg()
  14. but  this  too  seems  to have some unusual problems.  Maybe
  15. someone  can shed some light on this for me.  If I LoadSeg()
  16. a  library  and look at the resident structures rt_IdString,
  17. on  certain  libraries  the  first  4  bytes of the IdString
  18. contain  \0\4\251\128.  Strlen() obviously thinks the string
  19. is  0  bytes  long because of the zero in position 0 but the
  20. IdString  follows  right after \128.  Using OpenLibrary() on
  21. the  same  lib will give me the IdString as it should be.  I
  22. also get enforcer hits reading certain IdStrings even though
  23. the string is properly terminated.  I appreciate any help on
  24. this...
  25.  
  26. ------------------------------------------------------------
  27. void MyLoadSeg(char *LibName)
  28. {
  29.    BPTR LibSeg;
  30.    struct Resident *ResLib;
  31.    char Buffer[128];
  32.  
  33.    if(LibSeg=LoadSeg(LibName))
  34.    {
  35.       ResLib=(struct Resident *)((LONG *)BADDR(LibSeg)+2);
  36.       strcpy(Buffer,ResLib->rt_IdString);
  37.       printf("strlen(%d) \n",strlen(Buffer));
  38.       printf("%s\n",Buffer);
  39.       UnLoadSeg(LibSeg);
  40.    }
  41. }
  42.  
  43. -------------------------------------------------------------------
  44.   Norman Baccari             | "OK team! You start coding.           
  45.   normb@gpu.utcc.utoronto.ca | I'll go see what the user specs are." 
  46.   Toronto,Ontario,Canada     |                                        
  47. -------------------------------------------------------------------
  48.